/*
 * Copyright 2008, 2009 Kobi Krasnoff
 * 
 * This file is part of "Catch Falling Coins".
 *
 * "Catch Falling Coins" is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * "Catch Falling Coins" is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with "Catch Falling Coins".  If not, see <http://www.gnu.org/licenses/>.
 *
 */

import javax.microedition.lcdui.Image;

/**
 * This is the class factory which return the appropriate object to the game canvas
 * @author kobi
 *
 */
public class BasicObjectSpriteFactory {
	public final static int EXPLOSION_SPRITE = 1;
	public final static int BOMB_SPRITE = 2;
	public final static int GOLDCOIN_SPRITE = 3;
	public final static int SILVERCOIN_SPRITE = 4;
	
	/**
	 * This is the function which return the appropriate object to the game canvas
	 * @param className Class name in a string
	 * @return Some object derived class
	 */
	public static BasicObjectSprite returnObject(int className)
	{
		Image img = Image.createImage(1, 1);
		switch(className)
		{
		case BOMB_SPRITE:
			return new BombSprite(img);
		case EXPLOSION_SPRITE:
			return new ExplosionSprite(img);
		case GOLDCOIN_SPRITE:
			return new GoldCoinSprite(img);
		case SILVERCOIN_SPRITE:
			return new SilverCoinSprite(img);
		default:
			return null;
		}
	}
}
